import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 拓展目标_客户_用电户号信息 */
export interface ExpandTargetPowerAccount {
  id: number // ID
  account: string // 户号
  name: string // 户名
  powerType: string // 用电类型
  voltageLevel: string // 电压等级
  countMode: string // 计量方式
  powerTimes: number // 供电计量倍率
  customerType: string // 客户类型
  transformerAmount: number // 变压器数量
  transformerVolume: number // 变压器容量
  workingYears: number // 运行年限
  maintenanceMode: string // 维护方式
  isBreakdown: string // 是否故障
  customerId: number // 所属客户id
  ownerUserId: number // 拓展负责人id
}

// 拓展目标_客户_用电户号 API
export const ExpandTargetPowerAccountApi = {
  // 查询拓展目标_客户_用电户号分页
  getExpandTargetPowerAccountPage: async (params: any) => {
    return await request.get({ url: `/san/biz-expand-target-power-account/page`, params })
  },

  // 查询拓展目标_客户_用电户号详情
  getExpandTargetPowerAccount: async (id: number) => {
    return await request.get({ url: `/san/biz-expand-target-power-account/get?id=` + id })
  },

  // 新增拓展目标_客户_用电户号
  createExpandTargetPowerAccount: async (data: ExpandTargetPowerAccount) => {
    return await request.post({ url: `/san/biz-expand-target-power-account/create`, data })
  },

  // 修改拓展目标_客户_用电户号
  updateExpandTargetPowerAccount: async (data: ExpandTargetPowerAccount) => {
    return await request.put({ url: `/san/biz-expand-target-power-account/update`, data })
  },

  // 删除拓展目标_客户_用电户号
  deleteExpandTargetPowerAccount: async (id: number) => {
    return await request.delete({ url: `/san/biz-expand-target-power-account/delete?id=` + id })
  },

  /** 批量删除拓展目标_客户_用电户号 */
  deleteExpandTargetPowerAccountList: async (ids: number[]) => {
    return await request.delete({
      url: `/san/biz-expand-target-power-account/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出拓展目标_客户_用电户号 Excel
  exportExpandTargetPowerAccount: async (params) => {
    return await request.download({
      url: `/san/biz-expand-target-power-account/export-excel`,
      params
    })
  }
}
